<?php
MYTCONN();
  $Qr_rs = $GLOBALS['MYT']->db_array("SELECT 0 AS O_ID, logI_Fecha AS COL1, name AS COL2, logI_Terminal AS COL3, logI_Proceso AS COL4
  			FROM hd_historicoalteracionesbasico
  			INNER JOIN systemoffice.main_users ON ref = logI_User
			WHERE logI_Proceso = 'AML_CLOSE'
			AND logI_NumDoc = {$_POST['amh_ID']}");
$CARD = $Qr_rs[0];
$SUM = 0; ?>
<script charset="utf-8" type="text/javascript">
disableSelection(document.getElementById("AMLList1"));
Ext.onReady(function(){
    var myData = [
	<?php
	for ($i=1;$i<=$CARD;$i++) {
	echo '['.$i.','.$Qr_rs[$i]['O_ID'].',\''.$Qr_rs[$i]['COL1'].'\',\''.$Qr_rs[$i]['COL2'].'\',\''.$Qr_rs[$i]['COL3'].'\',\''.$Qr_rs[$i]['COL4'].'\']';
		if ($i<$CARD) {
			echo ',';
		}
    } ?>
    ];

    var ds = new Ext.data.Store({
        reader: new Ext.data.ArrayReader({}, [
               {name: 'id'},
			   {name: 'O_ID', type: 'int'},
               {name: 'COL1', type: 'string'},
               {name: 'COL2', type: 'string'},
               {name: 'COL3', type: 'string'},
			   {name: 'COL4', type: 'string'}
          ])
    });
    ds.loadData(myData);
    var colModel = new Ext.grid.ColumnModel([
    {header: "N", width: 40, sortable: true, locked:true, dataIndex: 'id'},
		{header: "Registo", width: 40, sortable: true, locked:true, dataIndex: 'O_ID'},
		{header: "Utilizador", width: 120, sortable: true, locked:true, dataIndex: 'COL2'},
        {header: "Data", width: 120, sortable: true, locked:true, dataIndex: 'COL1'},
        {header: "Terminal", width: 200, sortable: true, dataIndex: 'COL3'},
        {header: "Processo", width: 200, sortable: true, locked:true,dataIndex: 'COL4'}
    ]);

   var selmode = new Ext.grid.RowSelectionModel({});
   var Console = new Ext.grid.GridPanel({
		ds: ds,
		cm: colModel,
		sm: selmode,
		height: 300,
        renderTo: 'AMLList1'
    });
});
</script>
<div id="AMLList1"></div>